package com.amos.muexamclient.sys.service.impl;

import com.amos.muexamclient.sys.entity.SysRoleDeptEntity;
import com.amos.muexamclient.sys.mapper.SysRoleDeptMapper;
import com.amos.muexamclient.sys.service.SysRoleDeptService;
import com.amos.muexamclient.sys.service.dto.SysRoleDeptDTO;
import com.amos.muexamcore.core.AbstractPageService;
import com.amos.muexamcore.core.BaseMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * Copyright © 2018 五月工作室. All rights reserved.
 *
 * @Package com.amos.muexamclient.sys.service.impl
 * @ClassName SysRoleDeptServiceImpl
 * @Description TODO
 * @Author Amos
 * @Modifier
 * @Date 2020-03-24 14:36:03
 * @Version 1.0
 **/
@Service
public class SysRoleDeptServiceImpl extends AbstractPageService<SysRoleDeptDTO, SysRoleDeptEntity> implements SysRoleDeptService {

    @Autowired
    private SysRoleDeptMapper sysRoleDeptMapper;

    /**
     * 条件查询
     *
     * @param dto 查询的条件
     */
    @Override
    public List<SysRoleDeptDTO> list(SysRoleDeptDTO dto) {
        return this.getMapper().select(dto);
    }

    /**
     * 返回BaseDao对象
     */
    @Override
    public BaseMapper<SysRoleDeptEntity, SysRoleDeptDTO> getMapper() {
        return sysRoleDeptMapper;
    }

    /**
     * 保存之间的校验
     *
     * @param dto 保存的对象
     */
    @Override
    public void preValidate(SysRoleDeptDTO dto) {

    }

    /**
     * 添加子集数据
     *
     * @param id  主表ID
     * @param dto 主表DTO对象
     */
    @Override
    public void appendSubsidiary(String id, SysRoleDeptDTO dto) {

    }

    @Override
    public void deleteRoleDeptByRoleId(String id) {
        this.sysRoleDeptMapper.deleteRoleDeptByRoleId(id);
    }

    @Override
    public int batchRoleDept(List<SysRoleDeptDTO> list) {
        return this.sysRoleDeptMapper.batchRoleDept(list);
    }
}
